import { createRouter, createWebHistory } from 'vue-router'
// 导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'
import ScreenVue from '@/views/Screen.vue'
import UserInfoVue from '@/views/user/UserInfo.vue'
import UserResetPasswordVue from '@/views/user/UserResetPassword.vue'
import UploadDataVue from '@/views/user/UploadData.vue'
// 定义路由关系
const routes = [
    { path: '/', component: LoginVue },
    { path: '/login', component: LoginVue },
    {
        path: "/layout",
        component: LayoutVue,
        redirect: "/layout/screen",
        // 嵌套路由
        children: [
            {
                path: "/layout/screen",
                component: ScreenVue
            },
            {
                path: "/layout/info",
                component: UserInfoVue
            },
            {
                path: "/layout/uploadData",
                component: UploadDataVue
            },
            {
                path: "/layout/resetPassword",
                component: UserResetPasswordVue
            }
        ]
    }
]
//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})
// 导出路由器
export default router

